<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="text">
<input type="text" id="input2">

<input type="button" value="按钮" onclick="f()">
<div>div</div>
<script>
    function f(){
        /*querySelector 获取第一个input标签*/
        /*querySelector(".class1") 获取第一个class1类*/
        let i=document.querySelector("#input2");
        let y=document.querySelector("input");
        console.log(i.value);
        /*querySelector("div") 获取第一个div标签*/
        let d=document.querySelector("div");
        d.innerText=i.value+y.value;
    }
</script>

</body>
</html>